﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site_Usuario.Master" Inherits="System.Web.Mvc.ViewPage<Proyecto_e.Models.encuesta>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Create    
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server" >
<body>
<script  type="text/javascript">

    function iniciar() {
        document.getElementById('titulo').value = '<%= ViewData["titulo"] %>';
        document.getElementById('descripcion').value = '<%= ViewData["descripcion"] %>';
        document.getElementById('imagen').value = '<%= ViewData["imagen"] %>';
    }

    function actualizar(img, obj) {
        img.src = obj.value;
    }

</script>


<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="/Usuarios/Inicio_Usuario">&nbsp;Inicio</asp:HyperLink> >> Nueva Encuesta
     
<% using (Html.BeginForm("Create", "Pregunta", FormMethod.Post)) ; %>
    <form name="form1" id="form1" method="post" runat="server" action="/Pregunta/Create">
    <input  type="hidden" id="verificar" name="verificar"  />
    <div>
        <br />
        <br />
        <h1 style="font-size: small">ELIGE COMO QUIERES CREAR TU ENCUESTA</h1>
        <p style="font-size: small">&nbsp;</p>
    </div>
     <div>

             <br />

             Estado 
             inicial de la encuesta
             <br />
             <br />
             <input type="radio" name="estado" value="abierta" checked="checked" /> Abierta al publico
             <input type="radio" name="estado" value="cerrada" /> Cerrada al publico

             <label for="Logotipo"> 
             <br />
             Elige tu logotipo:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </label>  
             <img alt="" src="../../Content/images/folder.png" tyle="height: 33px; width: 41px"/>

             <label for="Logotipo"> 
             <input type="file" name="imagen" id="imagen"  class="uploadForm"  onchange ="actualizar(document.forms[0].img1, this"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
             <img id="img1" alt="imagen previa" style="height: 50px; width: 42px" /><br />
              &nbsp;<br />
             <br />
             T&iacute;tulo de la encuesta:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </label>
           
    &nbsp;<textarea id="titulo" name="titulo" rows="2" cols="50" > </textarea><br />
             <br />
             <br />
             Descripci&oacute;n de la encuesta:&nbsp;&nbsp;
             <textarea id="descripcion"  name="descripcion" rows="2" cols="50" ></textarea><br />
             <br />
             <br />            
             <br />
             <center><table  style="width:50%;">
                 <tr>
                     <td>
                         No</td>
                     <td>
                         pregunta</td>
                     <td>
                         Accion</td>
                 </tr>  
                  
            <% var a=1; %> 
            <% foreach (string item in (List<string>)ViewData["MyList"]) { %>
                <tr>           
                     <td>
                         <% =a %></td>
                     <td>
                         <%= item %></td>
                     <td>
                          <%: Html.ActionLink("Editar", "editar", "Pregunta", new { id = a, imagen = form1.Attributes["imagen"], titulo = form1.Attributes["titulo"], descripcion = form1.Attributes["descripcion"] }, null)%>
                          <%: Html.ActionLink("Eliminar", "eliminar", "Pregunta", new { id = a }, null)%></td>
            <% a = a + 1; %>
            </tr>
            <% }%>                    
             </table></center>
             
             <br />
             <br />
             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
             <asp:Button ID="Button1" type="submit" runat="server" Text="Nueva pregunta" style="font-weight: 700" />
             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
             <input id="Button2" name="Button2" type="submit" value="Guardar" 
                 style="font-weight: 700" />
             <br />
             <br />
            </div> 
           </form> 
              
    </body>
 </asp:Content>
